package com.test.io;

import java.io.File;
import java.io.FilenameFilter;

public class FileList {

	public void ls(String target) {
		File dir = new File(target);
		File[] children = dir.listFiles(new VODFilter());
		for(int i = 0; i < children.length; i++) {
			System.out.println(children[i].getName() + "\t" + children[i].length() + "\t" + children[i].lastModified());
		}
	}
	
	public static void main(String[] args) {
		String file = "D:/temp";
		FileList list = new FileList();
		list.ls(file);
	}
	
	class VODFilter implements FilenameFilter {

		private String[] exts = {".mpg", ".avi"};
		
		@Override
		public boolean accept(File file, String name) {
			return true;
			/*
			for(int i = 0; i < exts.length; i++) {
				if(name.endsWith(exts[i])) {
					return true;
				}
			}
			return false;
			*/
		}
	}
}
